package com.cos.consumer.servlet;

import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author: COS
 * @time: 2022/4/29 11:32
 * @description:
 */
@WebFilter("/*")
public class CacheFilter implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("xxxxxxxxx");
        System.out.println("xxxxxxxxx");
        System.out.println("xxxxxxxxx");
        // 创建HystrixRequestContext 用于保存请求缓存
        HystrixRequestContext.initializeContext();
        chain.doFilter(request,response);
    }
}
